<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        /*
          方法一：被转换变量调用toString()方法(只适用于Number,Boolean的数据类型,用于其他类型转换会报错)
        */
        var a = 123;
        a = a.toString();
        alert(typeof a);
        /*
          方法二：通用String()函数(五种基本类型都适用)
        */
        var b = null;
        b = String(b);
        alert(typeof b);

        var c = undefined;
        c = String(c);
        alert(typeof c);
    </script>
</head>
<body>
    
</body>
</html>